package router

import (
	jwt "gitee.com/sansaniot/ssiot-core/httpmvc/jwtauth"
	"github.com/gin-gonic/gin"
	ruleApi "ssdevice/internal/rule/api"
)

var RuleRouters = make([]func(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware), 0)

func init() {
	RuleRouters = append(RuleRouters, ruleRouter)
}

func ruleRouter(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := ruleApi.Rule{}

	rule := r.Group("/api/rule").Use(authMiddleware.MiddlewareFuncWithOutValidate())
	{
		rule.GET("/find", api.FindList)
		rule.GET("/get", api.Get)
		rule.POST("/add", api.Create)
		rule.POST("/modify", api.Modify)
		rule.POST("/remove", api.Remove)
		rule.POST("/disable", api.Disable)
		rule.POST("/enable", api.Enable)
	}
}
